package com.hrbxlh.virtualization.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.hrbxlh.virtualization.pojo.Cluster;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.beans.BeanUtils;

/**
 * @author cheer
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ClusterVO {

    /**
     * 集群Id
     */
    private Long id;

    /**
     * 集群名称
     */
    private String name;

    /**
     * 主节点镜像Id
     */
    private Long masterImageId;

    /**
     * 第一个从节点镜像Id
     */
    private Long firstSlaveImageId;

    /**
     * 第二个从节点镜像Id
     */
    private Long secondSlaveImageId;

    /**
     * 主节点镜像名称
     */
    private String masterImageName;

    /**
     * 第一个从节点镜像名称
     */
    private String firstSlaveImageName;

    /**
     * 第二个从节点镜像名称
     */
    private String secondSlaveImageName;

    /**
     * 创建人
     */
    private String username;

    public ClusterVO convertFor(Cluster cluster) {
        BeanUtils.copyProperties(cluster, this);
        name = cluster.getClusterName();
        return this;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getMasterImageId() {
        return masterImageId;
    }

    public void setMasterImageId(Long masterImageId) {
        this.masterImageId = masterImageId;
    }

    public Long getFirstSlaveImageId() {
        return firstSlaveImageId;
    }

    public void setFirstSlaveImageId(Long firstSlaveImageId) {
        this.firstSlaveImageId = firstSlaveImageId;
    }

    public Long getSecondSlaveImageId() {
        return secondSlaveImageId;
    }

    public void setSecondSlaveImageId(Long secondSlaveImageId) {
        this.secondSlaveImageId = secondSlaveImageId;
    }

    public String getMasterImageName() {
        return masterImageName;
    }

    public void setMasterImageName(String masterImageName) {
        this.masterImageName = masterImageName;
    }

    public String getFirstSlaveImageName() {
        return firstSlaveImageName;
    }

    public void setFirstSlaveImageName(String firstSlaveImageName) {
        this.firstSlaveImageName = firstSlaveImageName;
    }

    public String getSecondSlaveImageName() {
        return secondSlaveImageName;
    }

    public void setSecondSlaveImageName(String secondSlaveImageName) {
        this.secondSlaveImageName = secondSlaveImageName;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", id)
                .append("name", name)
                .append("masterImageId", masterImageId)
                .append("firstSlaveImageId", firstSlaveImageId)
                .append("secondSlaveImageId", secondSlaveImageId)
                .append("masterImageName", masterImageName)
                .append("firstSlaveImageName", firstSlaveImageName)
                .append("secondSlaveImageName", secondSlaveImageName)
                .append("username", username)
                .toString();
    }
}
